package main

import (
    "facecat"
    "io/ioutil"
)

var gPaint = facecat.CreatePaint()

func WndProc(hwnd facecat.HWND, msg uint32, wParam, lParam uintptr) (result uintptr) {
    return facecat.WndProcDefault(gPaint, hwnd, msg, wParam, lParam)
}

func main() {
    facecat.CreateMainWindow(gPaint, "FaceCat-Go", WndProc)
    xmlStr, _ := ioutil.ReadFile("xml//divexample.xml")
    facecat.RenderFaceCat(gPaint, string(xmlStr))
    //获取第二页
    tabPage := facecat.FindViewByName("TabPage2", gPaint.Views)
    div := facecat.CreateView("div")
    div.Location = facecat.CreatePoint(50, 50)
    div.Size = facecat.CreateSize(200, 200)
    div.ShowHScrollBar = true
    div.ShowVScrollBar = true
    facecat.AddViewToParent(div, tabPage)
    for i := 0; i < 10; i++{
        button := facecat.CreateView("button")
        button.Location = facecat.CreatePoint(float64(i * 40), float64(i * 40))
        button.Size = facecat.CreateSize(100, 20)
        facecat.AddViewToParent(button, div);
        button.Text = "确定"
    }
    facecat.ShowWindow(gPaint)
}